package repository.relsys.util;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.net.URLEncoder;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;


public class StringUtils
{

	private static String indent = "";


	
	public static String toStringByReflection(final Object instance)
	{
		//
		indent += "\t";

		StringBuffer buffer = new StringBuffer(instance.getClass() + ":\r\n");

		//
		Class<?> factory = instance.getClass();

		Field[] fields = factory.getFields();
		for (Field field : fields) {
			try {
				field.setAccessible(true);

				// if(field.isAccessible()) {
				String name = field.getName();
				Object value = field.get(instance);

				buffer.append(indent + name + " = " + value + "\r\n");
				// }

			} catch (Exception e) {
			}
		}

		//
		indent = indent.substring(0, indent.length() - 1);

		return buffer.toString();
	}

}

	